/*
 * This class is the model for StatusBar and contains information of which 
 * name and file the user have used and possibility to change them. 
 */
package cth.tda367.beavers.glossaryGame.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import cth.tda367.beavers.glossaryGame.util.IObservable;


public class StatusBar implements IObservable {
	
	private static StatusBar INSTANCE;
	private PropertyChangeSupport observers = new PropertyChangeSupport(this);
	private String currentName = "John";
	
	public StatusBar () {
		
	}
	
	public static StatusBar getInstance() {
		if(INSTANCE == null) {
			INSTANCE = new StatusBar();
		}
		return INSTANCE;
	}
	
	public String getCurrentName () {
		return currentName;
	}
	
	public void setListName (String listName) {
		observers.firePropertyChange("changeName", null, listName);
	}
	
	public void setCurrentName (String currentName) {
		this.currentName = currentName;
		observers.firePropertyChange("changeList", null, currentName);
	}

	@Override
	public void addObserver(PropertyChangeListener observer) {
		observers.addPropertyChangeListener(observer);
	}
	
	
	
}
